[perf][rocm]: accelerate strict VIME rollout with direct paged CK and graph-safe execution - #390
Merged
Merged
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
Signed-off-by: vensen <vensenmu@gmail.com>
Flink-ddd
force-pushed
the
perf/rocm-vime-rollout-overheads
branch
from
September 6, 2026 05:14
61abcb6 to
c9922db
Compare
Flink-ddd
marked this pull request as ready for review
September 6, 2026 05:15
Signed-off-by: vensen <vensenmu@gmail.com>
Flink-ddd
requested review from
EthanZero2Hero and
KJLdefeated
as code owners
September 6, 2026 08:10
Signed-off-by: vensen <vensenmu@gmail.com>
Signed-off-by: vensen <vensenmu@gmail.com>
Signed-off-by: vensen <vensenmu@gmail.com>
Signed-off-by: vensen <vensenmu@gmail.com>
Signed-off-by: vensen <vensenmu@gmail.com>
Signed-off-by: vensen <vensenmu@gmail.com>
Signed-off-by: vensen <vensenmu@gmail.com>
Signed-off-by: vensen <vensenmu@gmail.com>
Signed-off-by: vensen <vensenmu@gmail.com>
Signed-off-by: vensen <vensenmu@gmail.com>
Signed-off-by: vensen <vensenmu@gmail.com>
inaniloquentee
approved these changes
Sep 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
PR #388 established bitwise Qwen3/VIME train-rollout alignment on ROCm, but the strict R/R rollout path still carried substantial runtime overhead:
PR #390 moves the strict ROCm rollout path from a materialization-heavy adapter to a direct-paged, graph-safe execution pipeline while preserving the train/rollout arithmetic contract.
Optimization architecture
flowchart TB INPUT(["VIME strict R/R rollout"]) --> META["Forward-scoped metadata cache"] subgraph HOTPATH["Strict ROCm compute hot path"] direction LR QKV["Deterministic QKV GEMM"] --> ROPE["Token-major deterministic RoPE"] ROPE --> ATTN["Direct paged AITER/CK"] ATTN --> OPROJ["Direct-output O-projection"] end META --> QKV OPROJ --> IPC["Stable-buffer IPC fixed-tree reduce"] IPC --> HEAD["Prepared LM-head and strict logprob"] HEAD --> GATE{"Exactness and provenance gate"} GATE --> OUTPUT(["Aligned rollout output"]) subgraph CONTRACT["Strict arithmetic contract"] direction LR SPLIT["Split-KV disabled"] --> ACCUM["FP32 accumulation"] ACCUM --> TREE["Fixed reduction order"] TREE --> FALLBACK["No fallback"] end SPLIT -. "constrains" .-> ATTN TREE -. "constrains" .-> IPC FALLBACK -. "verified by" .-> GATE classDef runtime fill:#ddf4ff,stroke:#0969da,color:#24292f,stroke-width:2px classDef compute fill:#fff8c5,stroke:#bf8700,color:#24292f,stroke-width:2px classDef distributed fill:#dafbe1,stroke:#1a7f37,color:#24292f,stroke-width:2px classDef guard fill:#ffebe9,stroke:#cf222e,color:#24292f,stroke-width:2px class INPUT,META,OUTPUT runtime class QKV,ROPE,ATTN,OPROJ compute class IPC,HEAD distributed class SPLIT,ACCUM,TREE,FALLBACK,GATE guard style HOTPATH fill:#fffdf2,stroke:#bf8700,stroke-width:2px style CONTRACT fill:#fff5f5,stroke:#cf222e,stroke-width:2pxThe solid arrows represent the steady-state rollout data path. The dashed arrows represent the strict arithmetic constraints applied to kernel dispatch, accumulation, communication, and runtime acceptance.
The optimized route keeps tensors on the GPU, preserves framework-owned storage, and removes redundant synchronization, layout conversion, temporary allocation, and output-copy operations from steady-state decode.
Important
PR #390 changes execution and data movement while keeping the strict arithmetic schedule fail-closed, deterministic, and auditable.
Key optimizations
seqused_k, page bounds, and index metadata were reconstructed or validated in every decoder layermha_batch_prefillnum_splits=1catand adapter copiesinv_freq, and execute token-major HIP RoPE[K,N]weight cache and refresh it after IPC weight updatesDirect-paged Attention path
The optimized rollout path executes:
The direct path exposes the following runtime evidence:
This removes dense KV reconstruction from the primary rollout path without introducing a moving Split-KV reduction schedule.
Exactness-preserving contract
The optimizations change data movement, dispatch, allocation, and storage placement. They do not relax the strict arithmetic contract:
num_splitsis fixed at1.30-step post-merge validation
The strict route was exercised for 30 matched P/P and R/R steps on the
testintegration line. Mismatch counts compare selected-token log probabilities between the training and rollout paths.All 30 recorded steps are included in the averages below.
Train-rollout consistency
torch.equalAcross 1,920 comparisons, the strict R/R route remained byte-identical between training and rollout. The production P/P route produced 1,139 mismatches and a maximum absolute selected-token logprob difference of 1.041255.
Average performance across 30 steps
The 30-step result establishes the exactness property, but it does not establish performance parity with the production P/P route.
The remaining gap is concentrated in strict rollout execution, reference/logprob computation, and actor training. Weight synchronization is approximately at parity and is 1.27% faster in this measurement.
This result therefore serves both as end-to-end exactness evidence and as a baseline for the remaining ROCm optimization work.
Note
This is a post-merge
test-line validation snapshot. It must not be interpreted as an isolated performance attribution to PR #390 if the testedtestrevision also contains follow-up changes.Post-merge follow-up
PR #390 merged into
testatfed8362.The subsequent full-Graph work, route-specific AOT caching, position-plan optimization, and additional matched P/P versus R/R results are tracked in #393 so that results from different commit sets are not mixed into the isolated PR #390 performance claim.
The 30-step table above is retained as integration-level validation because it demonstrates that the strict route preserves zero mismatch under a longer matched workload while also making the remaining performance gap explicit.
Scope boundary
This PR optimizes the existing strict ROCm execution contract. It does not claim that every stage is faster than VIME production P/P, and it does not change arithmetic ordering solely for performance.
The current evidence establishes:
Potential follow-up work includes:
mha_batch_prefilloccupancy on gfx942;Related: #377, #385, #388, #393.